#include "pacmangame.h"
#include "ui_pacmangame.h"

PacmanGame::PacmanGame(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::PacmanGame)
{
    ui->setupUi(this);
    //从主页面打开关卡页面
    chooselevel_page=new ChooseLevel;
    ui->stackedWidget->addWidget(chooselevel_page);
    connect(ui->beginButton,&QPushButton::clicked,[=](){
        ui->stackedWidget->setCurrentWidget(chooselevel_page);
    });
    connect(chooselevel_page,&ChooseLevel::closeWindow,[=](){
        ui->stackedWidget->setCurrentWidget(ui->page);
    });
    //从主页面打开规则页面
    rule_page=new Rule;
    ui->stackedWidget->addWidget(rule_page);
    connect(ui->ruleButton,&QPushButton::clicked,[=](){
        ui->stackedWidget->setCurrentWidget(rule_page);
    });
    connect(rule_page,&Rule::closeWindow,[=](){
        ui->stackedWidget->setCurrentWidget(ui->page);
    });
}

PacmanGame::~PacmanGame()
{
    delete ui;
}






void PacmanGame::on_closeButton_clicked()
{
    close();
}
